

#ifndef Analyzer_H_
#define Analyzer_H_
#include <string>
#include <vector>
#include <map>
#include "Token.h"

using namespace std;

class Analyzer{
public:
	//Default CTOR
	Analyzer();
	//DTOR
	virtual ~Analyzer();
	//Copy CTOR
	Analyzer(const Analyzer& a) ;
	//Operator = overloading
	const Analyzer& operator=(const Analyzer& a);

	
	virtual bool analyze(map<int,vector<Token>>* m);
	
	virtual vector<string> getErrors() const;
	virtual map<string,int>* getFunctions();
	virtual map<string,int>* getVariables();
	virtual map<string,string>* getTypesOfVars();

	
private:

	const Analyzer& assign(const Analyzer& a);
	map<string,int>* funcs; 
	map<string,int>* vars;	
	map<string,string>* vars_and_types; 
 	vector<string> errorVector;

	Token getLastTokenFromRow(vector<Token>* row);
	Token getSecondLastTokenFromRow(vector<Token>* row);
	
	const bool isLegaldentifier(string& line) ;
	
	void checkIdentifierLegality(map<int,vector<Token>>* m); 
	void checkBrackets(map<int,vector<Token>>* m); 
	int checkMultipleTypes(map<int,vector<Token>>* m); 
	void checkMainLegality(map<int,vector<Token>>* m) ;
	 
	const bool checkIfElse(map<int,vector<Token>>* m) const;
	int getLastElseLine(map<int,vector<Token>>* m)const;
	string intToString(int i);
};
#endif


